<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // false 不相等的
    console.log(0.1 + 0.2 == 0.3);

    // 原因在于计算机底层会转换成二进制
    // 0.0001100110011001100110011001100110011001100110011001101
    console.log((0.1).toString(2));
    // 0.001100110011001100110011001100110011001100110011001101
    console.log((0.2).toString(2));

    // 0.1，0.2转换成二进制是个无线循环数，因此相加是不能精确相等的


  </script>
</body>

</html>